home *** CD-ROM | disk | FTP | other *** search
/ 3D Games - Real-time Rend…ng & Software Technology / 3D Games - Real-time Rendering & Software Technology.iso / flysdk / plugin / gamelib / subdiv_mesh.h < prev   
Encoding:
C/C++ Source or Header  |  2000-03-22  |  1.6 KB  |  60 lines

  1. class subdiv_mesh : public bsp_object
  2. {
  3. public:
  4.     subdiv_mesh() 
  5.     {
  6.         type=TYPE_SUBDIV_MESH; 
  7.         divmesh=0; nedges=0; edges=0; edgefaces=0;
  8.         dynlight.null();
  9.     };
  10.     ~subdiv_mesh() { reset(); };
  11.  
  12.     // dynamic vertex light info
  13.     light_vertex dynlights;    
  14.     // dynamic constant light info
  15.     vector dynlight;
  16.  
  17.     int nsubdiv;    // num subdivisions
  18.     int mode;        // mode: 0-standard 1-modified
  19.     mesh* basemesh;    // base mesh
  20.     mesh* divmesh;    // basemesh subdivided nsubdiv times
  21.  
  22.     int nedges;        // number of edges
  23.     int *edges;        // edges array (2*nedges)
  24.     int *edgefaces;    // faces array (2*nedges)
  25.     
  26.     void reset();    // reset allocated data
  27.     void subdiv();    // subdiv mesh nsubdiv times
  28.  
  29.     // finds edge with vertices v1,v2
  30.     int get_edge(int v1,int v2);
  31.     // get valence for vertex v1
  32.     int get_valence(int v1);
  33.  
  34.     // add all mesh edges to the edges array
  35.     void build_edge_list(mesh *m1);
  36.     // add a single edge to the edges array
  37.     void add_edge(int v1,int v2,int f);    
  38.     // add one vertex at m2 for each edge in m1
  39.     void add_vertices(mesh *m1,mesh *m2);
  40.     // add 4 faces in m2 for each face from m1
  41.     void add_faces(mesh *m1,mesh *m2);
  42.  
  43.     void init();
  44.     void draw();
  45.     int step(int dt) { return 0; };
  46.     mesh *get_mesh() { return divmesh; };
  47.     int get_custom_param_desc(int i,param_desc *pd);
  48.     bsp_object *clone();
  49.     int message(vector& p,float rad,int msg,int param,void *data);
  50. };
  51.  
  52. class subdiv_mesh_desc : public class_desc
  53. {
  54. public:
  55.     void *create() { return new subdiv_mesh; };
  56.     char *get_name() { return "subdiv_mesh"; };
  57.     int get_type() { return TYPE_SUBDIV_MESH; };
  58. };
  59.  
  60.